import java.util.Arrays;

public class Test {


    public static int getWay(int n) {
        if (n == 1 || n == 2) {
            return n;
        }else {
            int a = 1;
            int b = 2;
            int c = 0;
            for (int i = 3; i <= n; i++) {
                c = a + b;
                a = b;
                b = c;
            }
            return c;
        }
    }

    public static void main8(String[] args) {
        System.out.println(getWay(4));
    }

    public static void mySort(int[] array) {
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if (array[i] % 2 == 1) {
                count++;
                int tmp = array[i];
                array[i] = array[count-1];
                array[count-1] = tmp;
            }
        }
        System.out.println(Arrays.toString(array));
    }

    public static void main7(String[] args) {
        int[] array = {1,2,3,4,5,6};
        mySort(array);
    }

    public static void findone(int[] array) {
        int count ;
        for (int i = 0; i < array.length; i++) {
            count = 0;
            for (int j = 0; j < array.length; j++) {
                if (array[i] == array[j]) {
                    count++;
                }
            }
            if (count == 1) {
                System.out.println(array[i]);
            }
        }
    }

    public static void main6(String[] args) {
        int[] array = {1,2,1,2,8,4,8};
        findone(array);
    }

    public static void main5(String[] args) {
        int[] array = {1,2,3,4};
        int[] ret = Arrays.copyOf(array,array.length*2);
        System.out.println(Arrays.toString(ret));

    }

    public static String myToString(int[] array) {
        if (array == null) {
            return null;
        }
        String ret = "[";
        for (int i = 0; i < array.length; i++) {
            ret += array[i];

            if (i != array.length-1) {
                ret +=", ";
            }
        }

        ret = ret + "]";
        return ret;
    }

    public static void main4(String[] args) {
        int[] array = {1,2,3,4};
        System.out.println(myToString(array));
        System.out.println(myToString(null));
    }

    public static int[] grow(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i] = array[i] * 2;
        }
        return array;
    }

    public static void main3(String[] args) {
        int[] array = {1,2,3,4,5,6,7,8};
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(grow(array)));
        System.out.println(Arrays.toString(array));
    }

    public static void main2(String[] args) {
        int[] array = {13,12,34,14,53,25};
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
        for (int x : array) {
            System.out.print(x+" ");
        }
        Arrays.sort(array);
        String ret = Arrays.toString(array);
        System.out.println(ret);
    }

    public static void hannota(int n,char pos1,char pos2, char pos3) {
        if (n == 1) {
            move(pos1,pos3);
            return;
        }
        hannota(n-1,pos1,pos3,pos2);
        move(pos1,pos3);
        hannota(n-1,pos2,pos1,pos3);
    }

    public static void move(char pos1,char pos2) {
        System.out.print(pos1 + "->" + pos2 + " ");
    }

    public static void main1(String[] args) {
        hannota(1,'A','B','C');
        System.out.println();
        hannota(2,'A','B','C');
        System.out.println();
        hannota(3,'A','B','C');
    }

}
